package Command;

import java.util.logging.Level;

import debuggen.Debug;
import Communication.Bluetooth;
import Communication.BluetoothConnection;

public abstract class Command 
{
	// BT connection
	protected static Bluetooth bt;
	// A value which can be used in the command
	private int intValue = -1;
	public static final String EOL = "\n\r";
	
	/**
	 * Execute
	 * Execute the command.
	 */
	public void execute()
	{
	}
	/**
	 * Undo
	 * Undo the command
	 */
	public void undo()
	{	
	}
	/**
	 * redo
	 * Redo the command
	 */
	public void redo()
	{
	}
	/**
	 * getCommandString
	 * @return String - containing command
	 */
	public String getCommandString()
	{
		return "0,1,2,3";
	}
	/**
	 * checkConnection
	 * @return boolean - True if connection is ok, false otherwise
	 */
	protected boolean checkConnection()
	{
		// Get the bt connectie
		Bluetooth bt = BluetoothConnection.getInstance(); 
		// Check if there is any connection!
		if(!bt.isConnected())
		{
			// If we are in debug mode!
			if(Debug.DEBUGGEN)
			{
				Debug.writeMessage("Probleem: poging tot uitvoeren van commande zonder BT verbinding", Level.INFO);
			}
			// If there is no connection, report this!
			return false;
		}	
		// Connection is ok!
		return true;
	}
	/**
	 * setValue
	 * @param p_intValue - a value
	 */
	public void setValue(int p_intValue)
	{
		intValue = p_intValue;
	}
	/**
	 * getValue
	 * @return int - a value
	 */
	public int getValue()
	{
		return intValue;
	}
}
